using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace Rabbit3.Api.Models
{
    /// <summary>
    /// 深加工信息表
    /// </summary>
    [SugarTable("processing_info")]
    public class ProcessingInfo
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 溯源信息ID
        /// </summary>
        [SugarColumn(IsNullable = false)]
        [Required(ErrorMessage = "溯源信息ID不能为空")]
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 班组
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(50)", IsNullable = false)]
        [Required(ErrorMessage = "班组不能为空")]
        [StringLength(50, ErrorMessage = "班组长度不能超过50个字符")]
        public string Team { get; set; } = string.Empty;

        /// <summary>
        /// 加工日期
        /// </summary>
        [SugarColumn(IsNullable = false)]
        [Required(ErrorMessage = "加工日期不能为空")]
        public DateTime ProcessingDate { get; set; }

        /// <summary>
        /// 加工负责人
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(30)", IsNullable = false)]
        [Required(ErrorMessage = "加工负责人不能为空")]
        [StringLength(30, ErrorMessage = "加工负责人长度不能超过30个字符")]
        public string ProcessingManager { get; set; } = string.Empty;

        /// <summary>
        /// 加工工艺
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(200)", IsNullable = true)]
        [StringLength(200, ErrorMessage = "加工工艺长度不能超过200个字符")]
        public string? ProcessingMethod { get; set; }

        /// <summary>
        /// 食品安全信息URL
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(500)", IsNullable = true)]
        [StringLength(500, ErrorMessage = "食品安全信息URL长度不能超过500个字符")]
        public string? FoodSafetyInfoUrl { get; set; }

        /// <summary>
        /// 人员卫生情况URL
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(500)", IsNullable = true)]
        [StringLength(500, ErrorMessage = "人员卫生情况URL长度不能超过500个字符")]
        public string? PersonnelHygieneUrl { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime UpdatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 是否删除
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 创建人ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? CreatedBy { get; set; }

        /// <summary>
        /// 更新人ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? UpdatedBy { get; set; }

        /// <summary>
        /// 导航属性 - 溯源信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public TraceabilityInfo? TraceabilityInfo { get; set; }
    }
}
